Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
remark-squeeze-paragraphs
Advanced tools
The remark-squeeze-paragraphs npm package is a plugin for the remark processor that removes empty paragraphs from Markdown content. It helps in cleaning up the Markdown by eliminating unnecessary whitespace and empty lines, making the content more compact and readable.
Remove Empty Paragraphs
This feature removes empty paragraphs from the given Markdown content. The code sample demonstrates how to use the remark-squeeze-paragraphs plugin with the remark processor to clean up the Markdown by eliminating unnecessary empty lines.
const remark = require('remark');
const squeezeParagraphs = require('remark-squeeze-paragraphs');
const markdown = `
# Title
This is a paragraph.
Another paragraph.
`;
remark()
.use(squeezeParagraphs)
.process(markdown, function (err, file) {
if (err) throw err;
console.log(String(file));
});
The remark-lint-no-empty-sections package is a remark-lint rule that checks for and warns about empty sections in Markdown content. Unlike remark-squeeze-paragraphs, which removes empty paragraphs, this package is used for linting purposes to ensure that sections are not left empty.
The remark-lint-no-consecutive-blank-lines package is another remark-lint rule that ensures there are no consecutive blank lines in Markdown content. While it does not remove the lines, it helps maintain a clean structure by warning about multiple blank lines, similar to how remark-squeeze-paragraphs removes them.
The remark-remove-comments package is a plugin for remark that removes HTML comments from Markdown content. While it focuses on removing comments rather than empty paragraphs, it serves a similar purpose of cleaning up the Markdown content.
remark plugin to remove empty (or whitespace only) paragraphs.
npm:
npm install remark-squeeze-paragraphs
var remark = require('remark')
var stripBadges = require('remark-strip-badges')
var squeezeParagraphs = require('remark-squeeze-paragraphs')
remark()
.use(stripBadges)
.processSync('![](https://img.shields.io/)\n\ntext')
.toString()
// => "\n\ntext\n"
remark()
.use(stripBadges)
.use(squeezeParagraphs)
.processSync('![](https://img.shields.io/)\n\ntext')
.toString()
// => "text\n"
remark().use(squeezeParagraphs)
Remove empty (or white-space only) paragraphs.
Use of remark-squeeze-paragraphs
does not involve rehype
(hast) or user content so there are no openings for
cross-site scripting (XSS) attacks.
mdast-squeeze-paragraphs
— mdast utility that is in the core of this pluginSee contributing.md
in remarkjs/.github
for ways
to get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
MIT © Eugene Sharygin
FAQs
remark plugin to remove empty paragraphs
We found that remark-squeeze-paragraphs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.